<style lang="less">
    @import "detail.less";
</style>
<template>
    <div>
    <div>
        <Affix :offset-top="120">
            <div class="contract-detial-affix">
                <Button type="primary" icon="md-backspace"  @click="back()">返回</Button>
            </div>
        </Affix>
    </div>
    <div>
        <detailForBusinessView v-show="viewModel" ref="detailForBusinessView" :obj="viewObj"></detailForBusinessView>
        <detailForDeal v-show="dealModel" ref="detailForDeal" :obj="viewObj" @afterHandle="afterHandle"></detailForDeal>
        <detailForBusinessEdit v-show="editModel" ref="detailForBusinessEdit" :obj="viewObj"
                               @afterHandle="afterHandle"></detailForBusinessEdit>
    </div>
    </div>
</template>
<script>
    import detailForBusinessView from "./detailForBusinessView";
    import detailForBusinessEdit from "./detailForBusinessEdit";
    import detailForDeal from "./detailForDeal";

    export default {
        name: "detailForBusinessDetial",
        components: {
            detailForBusinessView,
            detailForBusinessEdit,
            detailForDeal
        },
        props: {
            obj: {
                caseNo: "",
                contractNo: "",
                id: "",
                caseType: "",
                type: Object
            }
        },
        data: function () {
            return {
                viewModel: false,
                dealModel: false,
                editModel: false,
                modalTitle: "",
                modalVisible: false,
                startDate: null,
                endDate: null,
                searchForm: {
                    caseNo: "", custName: "", contractNo: "", caseSource: "",
                    receivingBank: "", caseStatus: "", caseType: "", startTimeS: "",
                    startTimeE: "", endTimeS: "", endTimeE: "", allCase: false
                },
                data: [],
                dataForExport: [],
                exportReady: false,
                total: 0,
                dicKeys: [
                    "bankCode", "caseStatus", "caseType", "businessSource", "PersonRoleType", "contractStatus", "channelType"
                ],
                dataDict: {},
                loading: false,
                viewObj: {
                    caseNo: "",
                    contractNo: "",
                    id: "",
                    collectionType: "receivableRent"//收款类型：月供收款
                },
            }
        },
        created() {
            this.getParams();
        },
        methods: {
            // 获取初始数据
            getParams() {
                const params = this.afs.getPageParams(this);
                this.params = params;
                this.viewModel = params.viewModel;
                this.dealModel = params.dealModel;
                this.editModel = params.editModel;
                this.viewObj.caseType = params.caseType;
                this.viewObj.contractNo = params.contractNo;
                this.viewObj.caseNo = params.caseNo;
                this.viewObj.id =  params.id;
                this.viewObj.dataSource =  params.dataSource;
                this.viewObj.prepaymentApplyId =  params.prepaymentApplyId;
            },
            afterHandle() {
                this.back();
            },
            back() {
                //关闭页面
                this.afs.closeTab(this);
            },
            getCorporateList() {
                // 多条件搜索任务列表
                this.loading = true;
                queryCorporateList(this.searchForm).then(res => {
                    this.loading = false;
                    if (res.code === "0000") {
                        this.data = res.data.records;
                        this.total = res.data.total;
                    }
                });
                this.selectCount = 0;
            },
        }
    }
</script>

<style scoped>

</style>
